<?php
include('../paging_muser/paginator.class.php');
error_reporting(E_ALL^E_NOTICE);
if($_SERVER['HTTP_HOST']=="www.ramkydelhi.com"||$_SERVER['HTTP_HOST']=="ramkydelhi.com")
{
	$conn = new mysqli('localhost', 'ramky123_ramky', 'ramky123','ramky123_ramky') ;
}
else
{
	$conn = new mysqli('localhost', 'root', 'spPRdDCA2m47dmKa','ramky123_ramky') ;
}
$query = "SELECT id,name,usertype,loginid,password,emailid,status FROM tbl_dtls_createuser WHERE usertype!='Admin'";

if(!empty($_GET['search'])){
	$searchQuery = $_GET['search'];
}

$pageId= intval($_GET['page']);
if (empty($pageId)) {
	$pageId = 1;
}else{
	$pageId = intval($pageId); 
}

$recPerPage = 50;
$paginator = new Paginator($pageId,$recPerPage,$query,$conn);

// fields to search in
// string or array of fields
$paginator->fields = 'name';
$paginator->searchQuery = $searchQuery;
$rows = $paginator->paginate();
?>
<div id="listing_container">
<form name="frm1" action="del.php" method="request" id="frm1">											

 <table border="0" width="100%" id="table21" height="100%" cellspacing="1" style=" padding-top:0px" >

<tr><td><font face="Verdana" color="#006699" style="font-size: 8.5pt"><b>MANAGE USER</b></font></span></td>
</tr>
<tr>
	<td bgcolor="#F0F0F0">
	<font style="font-size: 8.5pt" face="Verdana" color="#003366">Select</font></td>
	<td width="0" height="0" bgcolor="#F0F0F0">
	<font style="font-size: 8.5pt" face="Verdana" color="#003366">S.No.</font></td>
	<td width="0" height="0" bgcolor="#F0F0F0">
	<font style="font-size: 8.5pt" face="Verdana" color="#003366">Name</font></td>
	<td width="" height="" bgcolor="#F0F0F0">
	<font style="font-size: 8.5pt" face="Verdana" color="#003366">User Type</font></td>
	<td width="0" height="0" bgcolor="#F0F0F0">
	<font style="font-size: 8.5pt" face="Verdana" color="#003366">Login Id</font></td>
	<td width="0" height="0" bgcolor="#F0F0F0">
	<font style="font-size: 8.5pt" face="Verdana" color="#003366">Email Id</font></td>
	<td width="0" height="0" bgcolor="#F0F0F0">
	<font style="font-size: 8.5pt" face="Verdana" color="#003366">Edit</font></td>
	<td width="0" height="0" bgcolor="#F0F0F0">
	<font style="font-size: 8.5pt" face="Verdana" color="#003366">Delete</font></td>
	<td width="0" height="0" bgcolor="#F0F0F0">
	<font style="font-size: 8.5pt" face="Verdana" color="#003366">Status</font></td>
</tr>
<?php 
$i=1;
foreach($rows as $row)
{
	if($row['status']==1)
	{
		$s ='Active';
	}
	else
	{
		$s = 'Deactive';
	}
?> 
<tr>
<td width="0" align="center">
<input type="checkbox" name="ids[]" id="ids[]" value="<?php echo "$row[id]";?>"></td>
<td width="0"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo "$row[id]";?></font></td>
<td width="0"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo "$row[name]";?></font></td>
<td width="0"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo "$row[usertype]";?></font></td>
<td width="0"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo "$row[loginid]";?></font></td>
<td width="0"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo "$row[emailid]";?></font></td>                                                   
<td width="0" align="center">
<p align="center"><a href="edit_user.php?cid=<?php echo "$row[id]"; ?>">
<img border="0" src="images/edit.png" width="16" height="16"></a></td>
<td width="0" align="center">
<p align="center"><a href="#" onClick="delete_confirm(<?php echo "$row[id]"; ?>)">
<img src="images/b_drop.png" border="0" />
 </a></td>
<td width="0" align="center">
<p align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><a style="text-decoration:none" href="status1.php?id=<?php echo "$row[id] &st=$row[status]";?>"><?php echo $s;?></a></font></td>
</tr>
<?php
$i++;
}
?>
<tr>
<td width="0" colspan="10">

<p align="center">
<input name="checkall" type="button" onclick='checkedAll();' value="Select All" style="border:1px solid #000000; font-size: 8pt; font-family: Verdana; "/>&nbsp;
<input type="submit" value="Delete Selected" name="B1" style="border:1px solid #000000; font-size: 8pt; font-family: Verdana; "/>
</form>
<?php
echo "</table><br />";		
													
?>													
													
													
													
													
												
											
<?php
$links = $paginator->getLinks ();
echo "<div class='paginator'> " . $links ;

echo "<p>Page " . $paginator->pageId . " of " . $paginator->totalPages . "</p>";
echo "</div>";
?>
<script language='javascript'>
checked=false;
function checkedAll () {
	var aa= document.getElementById('frm1');
	 if (checked == false)
          {
           checked = true
          }
        else
          {
          checked = false
          }
	for (var i = 0; i < aa.elements.length; i++) 
	{
	 aa.elements[i].checked = checked;
	}
  }
 /* var form='frm1'
  function SetChecked(val) {
  dm1=document.forms[form];
  len=dm1.elements.length;
  for(var i=0;i<len;i++)
  {
  dm1.elements[i].checked=val;
  }
  }*/
	  
</script>